home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 September / Australian PC User - September 2003 (CD1).iso / magstuff / web / files / dwmx61.exe / Disk1 / data1.cab / Configuration_En / Commands / Source Formatting Selection.js < prev    next >
Encoding:
JavaScript  |  2002-11-25  |  822 b   |  31 lines

  1. // Copyright 2001 Macromedia, Inc. All rights reserved.
  2. //-----------------------------------------------------
  3. //
  4. // Source Formatting Selection.js
  5. //
  6. // This file contains the implementation to fire off the Dreamweaver
  7. // source formatter to the selection.
  8.  
  9. function canAcceptCommand(){
  10.   var retVal = false;
  11.   var dom = dw.getDocumentDOM();
  12.  
  13.   if (dom && (dom.getParseMode() == 'html' || dw.getDocumentDOM().getParseMode() == 'xml') && (dw.getFocus() == 'document' || dw.getFocus(true) == 'html' || dw.getFocus() == 'textView')){
  14.     var selArr = dom.getSelection();
  15.     if (selArr[0] == selArr[1]){
  16.       retVal = false;
  17.     }else{
  18.       retVal = true;
  19.     }
  20.   }
  21.  
  22.    return retVal;
  23. }
  24.  
  25. function formatSourceSelection()
  26. {
  27.    dw.getDocumentDOM().formatSelection();
  28.    
  29.    return;         
  30. }
  31.